-
Notifications
You must be signed in to change notification settings - Fork 631
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deprecation for zone
in favour of explicit zone_id
#421
Deprecation for zone
in favour of explicit zone_id
#421
Conversation
Zone names within Cloudflare are not universally unique which makes performing a lookup based on just the name a little troublesome. Two accounts can have the same zone name and both of these can be returned if the lookups are not restricted to the zone ID or account ID. To rememdy this, `zone` is being deprecated in favour of explicit `zone_id` values. See the discussion[1] on this for full details. Following Terraform's guidelines for deprecations[2], we are putting in a deprecation notice as part of a minor release and then in our next major release, we will actually perform the schema and functionality removal. This update will not prevent people from using `zone` however use will trigger a warning that it's going away and they should migrate themselves. [1]: https://github.com/terraform-providers/terraform-provider-cloudflare/issues/161#issuecomment-441128985 [2]: https://www.terraform.io/docs/extend/best-practices/deprecations.html#provider-attribute-removal
af8fe8a
to
c75c477
Compare
Confirmed this is working for a tested resource.
|
🥽 |
Think we've been a bit premature with this.
pagerule with zone_id specified:
pagerule with both zone and zone_id specified:
Looking in resource_cloudflare_page_rule.go, it seems zone is still Required and zone_id is computed (hence the above). We probably shouldn't add deprecation warnings until we can take both the new AND old fields. Maybe set them both to Optional and have a check at least one (or only one if both wouldn't be valid) is set?
|
Good catch, @SteveGoldthorpe-Work. We should make |
We have been working to perform some breaking changes in cloudflare#227 and the first attempt at this in cloudflare#421 neglected to allow people to set `zone_id` and action the deprecation notice 🤦 This second attempt has the same goal of deprecating `zone` in favour of explicit `zone_id` however this time I've updated both schema properties to be optional and added some validation in the various `Create` methods to ensure that we get at least one of them during the swap over period. That code can be removed as soon we've cut a breaking change release. Closes cloudflare#439
We have been working to perform some breaking changes in #227 and the first attempt at this in #421 neglected to allow people to set `zone_id` and action the deprecation notice 🤦 This second attempt has the same goal of deprecating `zone` in favour of explicit `zone_id` however this time I've updated both schema properties to be optional and added some validation in the various `Create` methods to ensure that we get at least one of them during the swap over period. That code can be removed as soon we've cut a breaking change release. Closes #439
Zone names within Cloudflare are not universally unique which makes
performing a lookup based on just the name a little troublesome. Two
accounts can have the same zone name and both of these can be returned
if the lookups are not restricted to the zone ID or account ID.
To rememdy this,
zone
is being deprecated in favour of explicitzone_id
values. See the discussion on this for full details.Following Terraform's guidelines for deprecations, we are putting in
a deprecation notice as part of a minor release and then in our next
major release, we will actually perform the schema and functionality
removal. This update will not prevent people from using
zone
howeveruse will trigger a warning that it's going away and they should migrate
themselves.